var jwt = require('jsonwebtoken');
//引入jwt的验证
var expresJwt = require('express-jwt');
//生成jwt方法
const createJwt=(payload)=>{
   return  jwt.sign(payload,'nodejff75abcdefg', { expiresIn: 10*60 });
};
//验证
const authJwt=expresJwt({ secret: 'nodejff75abcdefg',//秘钥
       algorithms: ['HS256']})
       .unless({path: ['/user/login']}); //不被验证的路径

 module.exports={createJwt,authJwt}